package com.example.sofa_module.sofa.fragments.text;

import android.view.View;

import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewbinding.ViewBinding;

import com.example.common.mvvm.view.BaseFragment;
import com.example.sofa_module.databinding.FragmentSofachildBinding;
import com.example.sofa_module.sofa.entity.BeanEntity;
import com.example.sofa_module.sofa.fragments.video.VideoAdapter;
import com.example.sofa_module.sofa.fragments.video.VideoViewModel;

import java.util.List;

public class Fragment_text extends BaseFragment<FragmentSofachildBinding, TextViewModel> {

    @Override
    public View bindLayout() {
        return v.getRoot();
    }

    @Override
    public ViewBinding initBinding() {
        FragmentSofachildBinding fragmentSofachildBinding=FragmentSofachildBinding.inflate(inflater);
        return fragmentSofachildBinding;
    }
    @Override
    public void initView() {

    }
    @Override
    public void initData() {
      vm.sofa_list.observe(this, new Observer<List<BeanEntity>>() {
          @Override
          public void onChanged(List<BeanEntity> beanEntities) {
              TextAdapter textAdapter = new TextAdapter();
              v.SofaRe.setLayoutManager(new LinearLayoutManager(getContext()));
              v.SofaRe.setAdapter(textAdapter);
              textAdapter.setNewInstance(beanEntities);
          }
      });
    }
}
